package edu.zut.main.thread;

public class ThreadJoin {

    public static void main(String[] args) {
        VIPThread vipThread = new VIPThread();
        Thread thread = new Thread(vipThread);
        thread.start();

        for (int i = 1; i <= 100; i++) {
            if (i == 20){
                //vip插队，强行把CPU资源抢过来
                try {
                    thread.join();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println("普通客户" + i);
        }
    }
}
//银行排队   普通客户  vip客户
class VIPThread implements Runnable{

    @Override
    public void run() {
        for (int i = 1; i <= 10; i++) {
            System.out.println("vip"+i+"插队,很烦人");
        }
    }
}

